package com.stylefeng.guns.modular.tool;

import com.Tool.HCNetSDK;
import com.stylefeng.guns.modular.device.service.IDeviceService;
import com.sun.jna.NativeLong;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class DeviceMes {
    @Autowired
    private IDeviceService deviceService;

    static HCNetSDK hCNetSDK=HCNetSDK.INSTANCE;
    public NativeLong getlUserID(String IP,short PORT,String UserName,String Password){
        hCNetSDK.NET_DVR_Init();
        hCNetSDK.NET_DVR_SetConnectTime(2000,1);
        hCNetSDK.NET_DVR_SetReconnect(10000,true);
        HCNetSDK.NET_DVR_DEVICEINFO_V30 m_strDeviceInfo=new HCNetSDK.NET_DVR_DEVICEINFO_V30();
        NativeLong IUserID;
            String ip = IP;
            short port = PORT;
            String userName = UserName;
            String password = Password;
            IUserID = hCNetSDK.NET_DVR_Login_V30(ip, port, userName, password, m_strDeviceInfo);
            return IUserID;

    }
    public void clean(NativeLong lUserID){
        hCNetSDK.NET_DVR_Logout(lUserID);
        hCNetSDK.NET_DVR_Cleanup();
    }
}
